package net.mysoft.budgetsoft.system.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 部门
 * @author kangrui
 *
 */
@Table(name="t_org")
@Entity
public class TOrg extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2003262263406064731L;
	@Column(name="org_no", length=20)
	private String orgNo;		//部门编号
	private int type;			//部门类型
	@Column(length=20)
	private String tel;			//部门电话
	
	@ManyToOne(fetch=FetchType.LAZY)
	private TOrg parent;		//上级部门
	
	@OneToMany(mappedBy="parent", fetch=FetchType.LAZY)
	//@OrderBy("createDate desc")
	private List<TOrg> sons;	//下级部门
	
	@OneToMany(mappedBy="org", fetch=FetchType.LAZY)
	//@OrderBy("createDate desc")
	private List<TUser> users;	//部门的用户
	
	public TOrg getParent() {
		return parent;
	}
	public void setParent(TOrg parent) {
		this.parent = parent;
	}
	public List<TOrg> getSons() {
		return sons;
	}
	public void setSons(List<TOrg> sons) {
		this.sons = sons;
	}
	public List<TUser> getUsers() {
		return users;
	}
	public void setUsers(List<TUser> users) {
		this.users = users;
	}
	public String getOrgNo() {
		return orgNo;
	}
	public void setOrgNo(String orgNo) {
		this.orgNo = orgNo;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	
}
